package com.msf.tutorial.java8.chapter10;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 练习
 * 1、用reducing连接字符串
 */
public class C03Exam {

    public static void method1() {
        List<String> list = Arrays.asList("Java", "PHP", "Python");
        String joinString = list.stream().collect(Collectors.reducing ( (s1, s2) -> s1 + s2 ) ).get();
    }

    public static void method2() {
        List<String> list = Arrays.asList("Java", "PHP", "Python");
        String joinString = list.stream().collect(Collectors.reducing ("", i -> i, (s1, s2) -> s1 + s2 ) );
    }


}
